package com.jobs.repositories;

import com.jobs.pojo.Customer;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author: 王博
 * @create: 2024-04-25 08:45
 */
public interface CustomerMethodNameRepository extends PagingAndSortingRepository<Customer, Long> {

    List<Customer> findByName(String name);

    Customer findByNameAndId(String name, Long id);

    Customer findFirstByName(String name);

    @Transactional
    int deleteByName(String name);

    @Transactional
    int removeByName(String name);

    List<Customer> findByNameLikeAndAgeIsNot(String name,int age);

    List<Customer> findTop3ByNameIsNotNullOrderByCreateTimeDesc();

    Customer getFirstByName(String name);

    Page<Customer> findByName(String name, Pageable pageable);

    List<Customer> findByNameLike(String name);
}
